<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="vue.global.js"></script>
</head>
<body>
<div id = 'app'>
    {{message}}
</div>
<script>
    const app = Vue.createApp({
        data() {
            return {
                message: 'Hello World!',
            }
        },
        //监视
        //适合使用在一个值影响多个值的场景
        watch:{
            message(newValue,oldValue){
                console.log('新值：',newValue);
                console.log('旧值：',oldValue);
            }
        }
    });
    let vm = app.mount('#app');

    setTimeout(()=>{
        vm.message = 'hi vue';
    },2000)

</script>
</body>
</html>